package com.xuecheng.content.api;

import com.xuecheng.content.model.po.TeachplanWork;
import com.xuecheng.content.service.TeachplanWorkService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @description 课程绑定作业接口
 */
@Api(value = "课程绑定作业接口",tags = "课程绑定作业接口")
@RestController
public class TeachplanWoekController {


    @Resource
    private TeachplanWorkService teachplanWorkService;

    /**
     * 绑定作业到课程计划
     */
    @PostMapping("/teachplan/work/association")
    public void bindWork(@RequestBody TeachplanWork teachplanWork) {
        teachplanWorkService.bindWork(teachplanWork);
    }

    /**
     * 解绑课程计划作业
     */
    @DeleteMapping("teachplan/work/{teachplanWorkId}")
    public void unbindWork(@PathVariable Long teachplanWorkId) {
         teachplanWorkService.unbindWork(teachplanWorkId);
    }

    /**
     * 查询课程计划绑定的作业
     */
    @GetMapping("teachplan/work/{teachplanId}")
    public TeachplanWork queryTeachplanWork(@PathVariable Long teachplanId) {
        return teachplanWorkService.queryTeachplanWork(teachplanId);
    }

    /**
     * 查询课程绑定的所有作业
     */
    @GetMapping("teachplan/work/course/{courseId}")
    public List<TeachplanWork> queryCourseWorks(@PathVariable Long courseId) {
        return teachplanWorkService.queryCourseWorks(courseId);
    }
}
